from django.shortcuts import render

# Create your views here.
from django.views import View

from contents.models import ContentCategory
from goods.models import GoodsChannel
from meixixi.utils.my_category import get_categories


class IndexView(View):
    def get(self,request):
        categories = get_categories()

        contents = {}
        content_category = ContentCategory.objects.order_by('id')
        for category in content_category:
            contents[category.key] = category.content_set.all()
        context = {
            'categories':categories,
            'contents':contents
                }

        return render(request,'index.html',context=context)